package com.tsd.jxc.dashboard.controller;

import com.alibaba.fastjson.JSONObject;
import com.tsd.common.controller.BaseController;
import com.tsd.core.vo.ErrorCode;
import com.tsd.core.vo.HttpResult;
import com.tsd.jxc.dashboard.service.JxcDashboardService;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * @Description: 进销存首页
 * @Author wudw
 * @Date 2022-11-11 17:00
 * @Modefied By:
 */
@Controller
@Scope("prototype")
@RequestMapping("/api/v2")
public class JxcDashboardController extends BaseController {

    @Resource
    private JxcDashboardService jxcDashboardService;

    @ResponseBody
    @RequestMapping(value = "/queryJxcDashboard.action", method = RequestMethod.POST)
    public HttpResult<Object> queryJxcDashboard() {
        HttpResult<Object> hr = new HttpResult<>();
        try {
            JSONObject object = jxcDashboardService.queryJxcDashboard();
            hr.setData(object);
            hr.setCode(ErrorCode.CODE_SUCCESS);
        } catch (Exception e) {
            super.procException(hr, e);
        }
        return hr;
    }

}
